let dts = document.querySelectorAll(".home-hero-swiper dt");
console.log(dts);
// 监听器
let listener = function (event) {

    for (let i = 0; i < dts.length; i++) {
        let dt = dts[i];
        dt.classList.remove('home-hero-swiper-active')//删除dt一个classname
    }
    //获得被点击的元素
    let current = event.target;
    //给被点击的元素添加一个classname
    current.classList.add('home-hero-swiper-active');

    //将所有dd的z-index改变
    for (let i = 0; i < dts.length; i++) {
        let dt = dts[i];
        let dd = dt.nextElementSibling;
        dd.style.transition = 'all 2s'
        dd.style.zIndex = '0';
        dd.style.opacity = '0';

    }

    //找到被点击元素的下一个元素
    let next = current.nextElementSibling;
    next.style.transition = 'all 2s';
    next.style.zIndex = '10'
    next.style.opacity = '1'
}

// 给每个dt绑定点击监听器
for (let i = 0; i < dts.length; i++) {
    let dt = dts[i];
    dt.addEventListener('click', listener, false);
}